package 校招笔试.京东.京23819;

import java.util.Scanner;

/**
 * @author aodre , QQ : 480029069
 * @date 2023/8/21 19:56
 */
public class Main {

    static Scanner sc = new Scanner(System.in);


    public static void main1(String[] args) {
        int q = sc.nextInt();
        String s[] = new String[3];
        while(q-->= 0){
            s[0] = sc.nextLine();
            s[1] = sc.nextLine();
            s[2] = sc.nextLine();
        }
    }
//    public String check(String s[]){
//
//    }


    private static int n,m;
    public static void main2(String[] args) {
         n = sc.nextInt();
        m = sc.nextInt();
        sc.nextLine();
        char[][] nums = new char[n][m];
        for(int i = 0;i < n;i++){
            nums[i] = sc.nextLine().toCharArray();
        }
        System.out.println(recursion(0,0,nums,new Integer[n][m]));
    }

    public static int recursion(int i,int j,char[][]nums,Integer dp[][]){
        if(i == n || j == m || nums[i][j] == '*' ){
            return Integer.MAX_VALUE / 2;
        }
        if(i == n - 1 && j == m - 1){
            return 1;
        }
        if(dp[i][j] != null){
            return dp[i][j];
        }
        int ans = 0;
        ans = recursion(i + 1,j,nums,dp) + 1;
        ans = Math.min(recursion(i,j + 1,nums,dp) + 1,ans);
        ans = Math.min(ans,recursion(i + 1,j + 1,nums,dp) + 1);
        return dp[i][j] = ans;
    }



}
